﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AlphaSolutionsGP.Demo_classes
{
    class CourseDemo
    {
        Course c1;
        Course c2;
        private string passorfail;
        private int _pass;
        private int _fail;

        public CourseDemo()
        {
            if ((testCourseNoArgConstructor()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testCourseArgConstructor()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testCreateCourse()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testCourseGetters()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testAmmendCourse()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if ((testDeleteCourse()) == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
        }



        bool testCourseNoArgConstructor()
        {
            bool success = false;
            try
            {
                c1 = new Course();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }

        bool testCourseArgConstructor()
        {
            bool success = false;
            try
            {
                c2 = new Course("TEST1","test course", "Testing",1,30,"a course for testing","Standard requirements");
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testCreateCourse()
        {
            bool success = false;
            try
            {
                c2.createCourse();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testAmmendCourse()
        {
            bool success = false;
            try
            {
                c1.CourseCode = "ammen1";
                c1.ammendCourse();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testCourseGetters()
        {
            bool success = false;
            try
            {
                string courseCode = c2.CourseCode;
                string description = c2.Description;
                string department = c2.Department;
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testDeleteCourse()
        {
            bool success = false;
            try
            {
                c2.deleteCourse();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        public int Fail
        {
            get { return _fail; }
            set { _fail = value; }
        }

        public int Pass
        {
            get { return _pass; }
            set { _pass = value; }
        }
    }
}
